﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace ZuesControls.Converters
{
    public class ReadOnlyToColorConverter : IValueConverter
    {
        // 只读状态下的颜色（默认灰色）
        public Brush ReadOnlyColor { get; set; } = Brushes.Transparent;

        // 可编辑状态下的颜色（默认黑色）
        public Brush EditableColor { get; set; } = Brushes.White;

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool isReadOnly)
            {
                return isReadOnly ? ReadOnlyColor : EditableColor;
            }
            return DependencyProperty.UnsetValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
